import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Hua YY
 * Date: 2025-02-19
 * Time: 10:37
 */
class Solution18 {
    public List<Integer> findDisappearedNumbers(int[] nums) {
        //思路：使用Hash数组，用下标表示这个数字
        int n = nums.length;
        int[] tmp = new int[n+1];
        for(int i = 0 ; i < n ; i++){
            tmp[nums[i]]++;
        }
        List<Integer> list = new ArrayList<>();
        for(int i = 1 ; i < n + 1 ; i++){
            if(tmp[i] == 0){
                list.add(i);
            }
        }
        return list;
    }
}
public class Test18 {
}
